#include "main.h"
#include "../Classes/AppDelegate.h"
#include "CCEGLView.h"
#include <io.h>
#include <fcntl.h>

USING_NS_CC;

int APIENTRY _tWinMain(HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPTSTR    lpCmdLine,
	int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	// 	FreeConsole();        
	// 	if ( AllocConsole() )
	// 	{
	// 		int hCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
	// 		*stdout = *(::_fdopen(hCrt, "w"));
	// 		::setvbuf(stdout, NULL, _IONBF, 0);
	// 		*stderr = *(::_fdopen(hCrt, "w"));
	// 		::setvbuf(stderr, NULL, _IONBF, 0);			
	// 	}

	// create the application instance
	AppDelegate app;
	CCEGLView& eglView = CCEGLView::sharedOpenGLView();
	eglView.setViewName("Hello World");
	eglView.setFrameSize(320, 480);
	// set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line.
	// eglView.setDesignResolutionSize(480, 320);
	return CCApplication::sharedApplication().run();
}
